<template>
    <el-container>
        <el-aside :width="menuStore.menuWidth" class="transition-all">
            <AdminMenu></AdminMenu>
        </el-aside>
        <el-container>
            <el-header>
                <AdminHeader></AdminHeader>
            </el-header>
            <el-main>
                <AdminTagList></AdminTagList>
                <router-view v-slot="{ Component }">
                    <!-- 添加页面切换动画 -->
                    <Transition name="fade">
                        <!-- 添加响应式储存 -->
                        <KeepAlive>
                            <component :is="Component"></component>
                        </KeepAlive>
                    </Transition>
                </router-view>
            </el-main>
            <el-footer>
                <AdminFooter></AdminFooter>
            </el-footer>
        </el-container>
    </el-container>
</template>

<script setup>
import AdminFooter from './components/AdminFooter.vue';
import AdminTagList from './components/AdminTagList.vue';
import AdminMenu from './components/AdminMenu.vue';
import AdminHeader from './components/AdminHeader.vue';

import { useMenuStore } from '@/stores/menu';
import { onMounted } from 'vue';

const menuStore = useMenuStore()

// 加载后台页面时，移除dark
onMounted(() => {
    document.documentElement.classList.remove("dark")
})
</script>

<style scoped>
.el-header {
    padding: 0!important;
}
.el-footer {
    padding: 0!important;
}

.el-main{
    padding: 0!important;
}


.fade-enter-from {
    opacity: 0;
}

.fade-enter-to {
    opacity: 1;
}

.fade-leave-from {
    opacity: 1;
}
.fade-leave-to {
    opacity: 0;
}

.fade-enter-active {
    transition: all 0.4s;
    /* 添加延时，离开页面动画结束后才执行进入动画 */
    transition-delay: 0.4s;
}

.fade-leave-active {
    transition: all 0.4s;
} 

</style>